package com.mes.assemble.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.data.provider.Page;
import com.mes.task.dao.DemandDao;
import com.mes.task.domain.Demand;
import com.mes.util.ScheduleUtil;

@Service
public class DemandDataAccess {
	
	@Resource
	DemandDao demandDao;
	
	@Resource
	ScheduleUtil scheduleUtil;
	
	
	/**
	 * 获取架次计划界面的Demand
	 * @author cswen
	 * @param page
	 * @param parameters
	 * @throws Exception
	 */
	@DataProvider
	public void getAssembleAODemand(Page<Demand> page, Map<String, Object> parameters) throws Exception {
		String partUid = (String) parameters.get("partUid");
		String batchNum = (String) parameters.get("batchNum");
		String model = (String) parameters.get("model");
		String drawingId = (String) parameters.get("drawingId");
		List<Demand> productDemandList = this.demandDao.getAssembleAODemand(
				partUid, model,drawingId,batchNum, page);
		if (productDemandList != null && productDemandList.size() > 0) {
			scheduleUtil.initPage(page, productDemandList);;
		}
	}
}
